def calculate(up_to)
	sum=0
	(0..(up_to)).each do |x|
		if (x%3==0) || (x%5==0)
			sum=sum+x
		end
	end
	return sum
end

puts calculate(1000)